package com.tjhzzx.ibmsSupervisor.model.user;

import com.tjhzzx.ibmsSupervisor.enums.BModuleType;
import com.tjhzzx.ibmsSupervisor.model.dashboard.BDashboardRoot;
import com.tjhzzx.ibmsSupervisor.model.menu.BTreeMenuRoot;
import com.tjhzzx.ibmsSupervisor.model.common.BCommonModule;

import javax.baja.sys.Flags;
import javax.baja.sys.Property;
import javax.baja.sys.Sys;
import javax.baja.sys.Type;
import javax.baja.util.BFolder;

/**
 * @author Luc
 * @date 2020-01-28 20:40
 * @see BCommonModule
 */
public class BUserModule extends BFolder {

    public static final Property title = newProperty(Flags.READONLY, "User Management", null);

    public String getTitle() {
        return getString(title);
    }

    public void setTitle(String v) {
        setString(title, v, null);
    }

    public static final Property nIcon = newProperty(0, "user", null);

    public String getNIcon() {
        return getString(nIcon);
    }

    public void setNIcon(String v) {
        setString(nIcon, v, null);
    }

    public static final Property moduleType = newProperty(Flags.READONLY, BModuleType.treeMenu, null);

    public BModuleType getModuleType() {
        return (BModuleType) get(moduleType);
    }

    public void setModuleType(BModuleType v) {
        set(moduleType, v, null);
    }

    public static final Property pagePath = newProperty(Flags.READONLY, "/user", null);

    public String getPagePath() {
        return getString(pagePath);
    }

    public void setPagePath(String v) {
        setString(pagePath, v, null);
    }

    public static final Property url = newProperty(Flags.READONLY, "外部链接 http://", null);

    public String getUrl() {
        return getString(url);
    }

    public void setUrl(String v) {
        setString(url, v, null);
    }

    public static final Property dashboardRoot = newProperty(Flags.READONLY, new BDashboardRoot(), null);

    public BDashboardRoot getDashboardRoot() {
        return (BDashboardRoot) get(dashboardRoot);
    }

    public void setDashboardRoot(BDashboardRoot v) {
        set(dashboardRoot, v, null);
    }

    public static final Property treeMenuRoot = newProperty(Flags.READONLY, new BTreeMenuRoot(), null);

    public BTreeMenuRoot getTreeMenuRoot() {
        return (BTreeMenuRoot) get(treeMenuRoot);
    }

    public void setTreeMenuRoot(BTreeMenuRoot v) {
        set(treeMenuRoot, v, null);
    }

    public BUserModule() {
        super();
        BTreeMenuRoot treeMenuRoot = new BTreeMenuRoot();
        BUserTreeMenuItem userTreeMenuItem = new BUserTreeMenuItem();
        treeMenuRoot.add("UserTreeMenuItem", userTreeMenuItem);
        treeMenuRoot.setDescription("用户管理");
        treeMenuRoot.setFlags(treeMenuRoot.getSlot("description"), Flags.READONLY);
        setTreeMenuRoot(treeMenuRoot);
    }


    @Override
    public Type getType() { return TYPE; }
    public static final Type TYPE = Sys.loadType(BUserModule.class);
}
